-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/stmtsummary: migrate test-infra to testify (part 0) #26869
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cc @tisonkun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tisonkun: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/cc @xhebox @djshow832 PTAL. Thanks! |
util/stmtsummary/variables_test.go
Outdated
|
||
err := sv.setVariable(typeMaxStmtCount, "10", false) | ||
c.Assert(err, IsNil) | ||
require.Nil(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use NoError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thanks
/cc @mmyj |
@tisonkun: GitHub didn't allow me to request PR reviews from the following users: mmyj. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, false) | ||
require.Equal(t, false, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.LessOrEqual(t, en, 0)
is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, all this kind is fixed, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @mmyj , unit test failed due to Elements type not match, one is int64 and the other is int.
i am search testify api to see if there are some method can do the compare but ignore the int type, otherwise seems a convert is required.
if so, they orginal one seems more simple.
what your idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think convert the int
to int64
can resolve this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixed, please check
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, true) | ||
require.Equal(t, true, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.Greater(t, en, 0)
is better?
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, false) | ||
require.Equal(t, false, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, true) | ||
require.Equal(t, true, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, true) | ||
require.Equal(t, true, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, false) | ||
require.Equal(t, false, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
util/stmtsummary/variables_test.go
Outdated
en = sv.getVariable(typeEnable) | ||
c.Assert(en > 0, Equals, true) | ||
require.Equal(t, true, en > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
||
err := sv.setVariable(typeMaxStmtCount, "10", false) | ||
c.Assert(err, IsNil) | ||
require.NoError(t, err) | ||
st = sv.getVariable(typeMaxStmtCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we don't need the var st
. How about the following code?
require.Equal(t, int64(10), sv.getVariable(typeMaxStmtCount))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for your suggestion.
please forgive me,but i think keep the var st
there is more clear and more consistent with the err part
err = sv.setVariable(typeEnable, "OFF", false)
require.NoError(t, err)
another reason is that this is a migrate, less change may let the whole job faster done and less mistake injected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
|
||
err := sv.setVariable(typeEnable, "OFF", false) | ||
c.Assert(err, IsNil) | ||
require.NoError(t, err) | ||
en = sv.getVariable(typeEnable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
sv := newSysVars() | ||
err := sv.setVariable(typeMaxStmtCount, "0", false) | ||
c.Assert(err, IsNil) | ||
require.NoError(t, err) | ||
v := sv.getVariable(typeMaxStmtCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
util/stmtsummary/variables_test.go
Outdated
@@ -65,31 +65,31 @@ func TestSetBoolVariable(t *testing.T) { | |||
err := sv.setVariable(typeEnable, "OFF", false) | |||
require.NoError(t, err) | |||
en = sv.getVariable(typeEnable) | |||
require.Equal(t, false, en > 0) | |||
require.LessOrEqual(t, en, 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format it.
util/stmtsummary/variables_test.go
Outdated
err = sv.setVariable(typeEnable, "OFF", true) | ||
require.NoError(t, err) | ||
en = sv.getVariable(typeEnable) | ||
require.Equal(t, false, en > 0) | ||
require.LessOrEqual(t, en, 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
util/stmtsummary/variables_test.go
Outdated
err = sv.setVariable(typeEnable, "", true) | ||
require.NoError(t, err) | ||
en = sv.getVariable(typeEnable) | ||
require.Equal(t, false, en > 0) | ||
require.LessOrEqual(t, en, 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 2be4a6f
|
@feitian124: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/run-check_dev_2 |
What problem does this PR solve?
Issue Number: close #26420
split from #26771, [0/2]
Release note